define(["jquery", "easy-admin", "treetable"], function ($, ea) {
    var table = layui.table,
        treetable = layui.treetable;
    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'mall.commission/index',
        edit_url: 'mall.commission/edit',
        export_url: 'mall.commission/export'
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                height:'full-50',
                toolbar: ['refresh',
                    [],
                    'export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id' , minwidth: 60},
                    {field: 'levelname', title: '等级名称', minwidth: 100},
                    {field: 'commission_firstmoney', title: '直推奖励%',search: false,  minwidth: 80},
                    {field: 'ordermoney', title: '升级条件',search:false,minwidth:160},
                    {field: 'membercount', title: '晋升条件',search:false,minwidth:120},
                    {field: 'sharepersont', title: '享受折扣',search:false,minwidth:100},
                    {field: 'commission_againpersont', title: '下级复购奖励', search: false,minwidth:100},
                    {
                        width: 200,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '编辑',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: 'data-full="true"',
                            }],
                        ]
                    }
                ]],
            });

            ea.listen();
        },
        edit:function (){
            ea.listen();
        }
    }
    return Controller;
});